import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

/* Layout */
import Layout from "@/layout";

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    noCache: true                if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true,
  },
  {
    path: "/404",
    component: () => import("@/views/404"),
    hidden: true,
  },
  {
    //护理单详情页(医院过五级评审使用)
    path: "/nursingRecord",
    component: () => import("@/views/nursingRecord/index"),
    hidden: true,
  },
  {
    path: "/",
    component: Layout,
    redirect: "/admin",
    hidden: true,
    children: [
      {
        path: "admin",
        hidden: true,
        component: () => import("@/views/dashboard/index"),
        meta: { title: "工作站首页", icon: "el-icon-s-help" },
      },
    ],
  },
  {
    path: "/dataStatistics",
    component: Layout,
    redirect: "/dataStatistics",
    meta: { title: "统计查询", icon: "el-icon-s-help" },
    hidden: true,
    children: [
      {
        path: "Patientinquiry",
        component: () => import("@/views/dataStatistics/Patientinquiry"),
        meta: { title: "病人查询", icon: "el-icon-c-scale-to-original" },
      },
    ],
  },
  {
    //护理模板具体模板页面
    path: "/dataAnalysis",
    component: Layout,
    children: [
      {
        path: "templateSet",
        component: () => import("@/views/dataAnalysis/templateSet"),
      },
    ],
  },
  {
    //通用字典子项页面
    path: "/interactive",
    component: Layout,
    children: [
      {
        path: "currencySub",
        component: () => import("@/views/interactive/currencySub"),
      },
    ],
  },
];
/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
  {
    path: "/",
    component: Layout,
    redirect: "/admin",
    type: "isWork",
    id: "0",
    children: [
      {
        path: "admin",
        id: "0-0",
        component: () => import("@/views/dashboard/index"),
        meta: { title: "工作站首页", icon: "el-icon-s-help" },
      },
    ],
  },
  {
    path: "/interface",
    component: Layout,
    type: "isWork",
    id: "1",
    meta: { title: "床位管理", icon: "el-icon-s-help" },
    children: [
      {
        path: "beedarrange",
        id: "1-2",
        component: () => import("@/views/interface/beedarrange"),
        meta: { title: "床位管理", icon: "el-icon-link" },
      },
      {
        path: "bedReservation",
        id: "1-3",
        component: () => import("@/views/interface/bedReservation"),
        meta: { title: "床位预约", icon: "el-icon-link" },
      },
    ],
  },
  {
    path: "/Qualitycontrol",
    redirect: "/Qualitycontrol/control",
    component: Layout,
    type: "isWork",
    id: "7",
    meta: { title: "质量管控", icon: "el-icon-s-help" },
    children: [
      {
        path: "control",
        id: "7-1",
        component: () => import("@/views/Qualitycontrol/control"),
        meta: { title: "质控指标维护", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "patientGive",
        id: "7-2",
        component: () => import("@/views/Qualitycontrol/patientGive"),
        meta: {
          title: "ICU患者收治率和ICU患者收治床日率",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "apaChell",
        id: "7-3",
        component: () => import("@/views/Qualitycontrol/apaChell"),
        meta: { title: "APACHEⅡ", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "caseFatalityq",
        id: "7-15",
        component: () => import("@/views/Qualitycontrol/caseFatalityq"),
        meta: {
          title: "感染性休克3h集束化治疗",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "caseFatalityw",
        id: "7-16",
        component: () => import("@/views/Qualitycontrol/caseFatalityw"),
        meta: {
          title: "感染性休克6h集束化治疗",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "bacterialInfections",
        id: "7-13",
        component: () => import("@/views/Qualitycontrol/bacterialInfections"),
        meta: {
          title: "ICU抗菌药物治疗前病原学送检率",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "dvtPrevention",
        id: "7-5",
        component: () => import("@/views/Qualitycontrol/dvtPrevention"),
        meta: {
          title: "ICU深静脉血栓（DVT）预防率",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "fatalityRate",
        id: "7-4",
        component: () => import("@/views/Qualitycontrol/caseFatality"),
        meta: {
          title: "ICU患者预计病死率",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "caseFatality",
        id: "7-14",
        component: () => import("@/views/Qualitycontrol/caseFatality"),
        meta: {
          title: "ICU患者标化病死指数",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "unplannedExtubation",
        id: "7-7",
        component: () => import("@/views/Qualitycontrol/unplannedExtubation"),
        meta: {
          title: "ICU非计划气管插管拔管率",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "48hReintubation",
        id: "7-8",
        component: () => import("@/views/Qualitycontrol/48hReintubation"),
        meta: {
          title: "ICU气管插管拔管后48h内再插管率",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "unplannedICU",
        id: "7-6",
        component: () => import("@/views/Qualitycontrol/unplannedICU"),
        meta: { title: "非计划转入ICU率", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "48hReentry",
        id: "7-9",
        component: () => import("@/views/Qualitycontrol/48hReentry"),
        meta: {
          title: "转出ICU后48h内重返率",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "vap",
        id: "7-10",
        component: () => import("@/views/Qualitycontrol/vap"),
        meta: {
          title: "ICU呼吸机相关性肺炎（VAP）发病率",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "crbsi",
        id: "7-11",
        component: () => import("@/views/Qualitycontrol/crbsi"),
        meta: {
          title: "ICU血管内导管相关血流感染（CRBSI）发病率",
          icon: "el-icon-c-scale-to-original",
        },
      },
      {
        path: "cauti",
        id: "7-12",
        component: () => import("@/views/Qualitycontrol/cauti"),
        meta: {
          title: "ICU导尿管相关泌尿系感染（CAUTI）发病率",
          icon: "el-icon-c-scale-to-original",
        },
      },

      {
        path: "zbedUse",
        id: "7-18",
        component: () => import("@/views/Qualitycontrol/zbedUse"),
        meta: { title: "ICU 床位使用率", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "zdoctorBed",
        id: "7-19",
        component: () => import("@/views/Qualitycontrol/zdoctorBed"),
        meta: { title: "ICU 医师床位比", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "znurseBed",
        id: "7-20",
        component: () => import("@/views/Qualitycontrol/znurseBed"),
        meta: { title: "ICU 护士床位比", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "zAnalgesicEvaluation",
        id: "7-21",
        component: () => import("@/views/Qualitycontrol/zAnalgesicEvaluation"),
        meta: { title: "ICU 镇痛评估率", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "zSedationEvaluation",
        id: "7-22",
        component: () => import("@/views/Qualitycontrol/zSedationEvaluation"),
        meta: { title: "ICU 镇静评估率", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "zConsciousnessAssessment",
        id: "7-23",
        component: () => import("@/views/Qualitycontrol/zConsciousnessAssessment"),
        meta: { title: "ICU 急性脑损伤患者意识评估率", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "z48ENinitiation ",
        id: "7-17",
        component: () => import("@/views/Qualitycontrol/z48ENinitiation"),
        meta: { title: "48h 内肠内营养（EN）启动率", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "zARDSPronePositionVentilation",
        id: "7-24",
        component: () => import("@/views/Qualitycontrol/zARDSPronePositionVentilation"),
        meta: { title: "中重度急性呼吸窘迫综合征（ARDS）患者俯卧位通气实施率（ICU-08）", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "zhongzheng",
        id: "7-25",
        component: () => import("@/views/Qualitycontrol/zhongzheng"),
        meta: { title: "自定义sql查询", icon: "el-icon-c-scale-to-original" },
      },
    ],
  },
  {
    path: "/dataStatistics",
    redirect: "/dataStatistics/dataStatistics",
    component: Layout,
    type: "isWork",
    id: "8",
    meta: { title: "统计分析", icon: "el-icon-s-help" },
    children: [
      {
        path: "Patientinquiry",
        id: "8-5",
        component: () => import("@/views/dataStatistics/Patientinquiry"),
        meta: { title: "病人查询", icon: "el-icon-c-scale-to-original" },
      },
      {
        path: "dataStatistics",
        id: "8-1",
        component: () => import("@/views/dataStatistics/dataStatistics"),
        meta: { title: "出入科", icon: "el-icon-c-scale-to-original" },
      },
    ],
  },
  {
    path: "/dataAnalysis",
    redirect: "/dataAnalysis/dataAnalysis",
    component: Layout,
    type: "isWork",
    id: "11",
    children: [
      {
        path: "nursing",
        id: "11-1",
        component: () => import("@/views/dataAnalysis/nursing"),
        meta: { title: "护理模板", icon: "el-icon-s-data" },
      },
    ],
  },
  {
    path: "/interactive",
    redirect: "/interactive/interactiveRecord",
    component: Layout,
    type: "isWork",
    id: "9",
    meta: { title: "字典管理", icon: "el-icon-s-help" },
    children: [
      {
        path: "list",
        id: "9-2",
        component: () => import("@/views/interactive/list"),
        meta: { title: "病区字典", icon: "el-icon-postcard" },
      },
      {
        path: "Department",
        id: "9-3",
        component: () => import("@/views/interactive/Department"),
        meta: { title: "科室字典", icon: "el-icon-postcard" },
      },
      {
        path: "interactiveRecord",
        id: "9-1",
        component: () => import("@/views/interactive/interactiveRecord"),
        meta: { title: "床位字典", icon: "el-icon-postcard" },
      },
      {
        path: "monitor",
        id: "9-4",
        component: () => import("@/views/interactive/monitor"),
        meta: { title: "监护仪字典", icon: "el-icon-postcard" },
      },
      {
        path: "diagnosis",
        id: "9-5",
        component: () => import("@/views/interactive/diagnosis"),
        meta: { title: "主要疾病得分字典", icon: "el-icon-postcard" },
      },
      {
        path: "currency",
        id: "9-6",
        component: () => import("@/views/interactive/currency"),
        meta: { title: "通用字典", icon: "el-icon-postcard" },
      },
      {
        path: "score",
        id: "9-7",
        component: () => import("@/views/interactive/score"),
        meta: { title: "评分字典", icon: "el-icon-postcard" },
      },
      {
        path: "respirator",
        id: "9-9",
        component: () => import("@/views/interactive/respirator"),
        meta: { title: "呼吸机字典", icon: "el-icon-postcard" },
      },
      {
        path: "respiratorbox",
        id: "9-10",
        component: () => import("@/views/interactive/respiratorbox"),
        meta: { title: "串口转网口模块字典", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/system",
    redirect: "/system/userManagement",
    component: Layout,
    type: "isWork",
    id: "10",
    meta: { title: "系统设置", icon: "el-icon-s-help" },
    children: [
      {
        path: "userManagement",
        id: "10-1",
        component: () => import("@/views/system/userManagement"),
        meta: { title: "用户管理", icon: "el-icon-postcard" },
      },
      {
        path: "roleManagement",
        id: "10-2",
        component: () => import("@/views/system/roleManagement"),
        meta: { title: "角色管理", icon: "el-icon-postcard" },
      },
      {
        path: "generalSetting",
        id: "10-5",
        component: () => import("@/views/system/generalSetting"),
        meta: { title: "通用设置", icon: "el-icon-postcard" },
      },
      {
        path: "alarmSet",
        id: "10-4",
        component: () => import("@/views/system/alarmSet"),
        meta: { title: "报警设置", icon: "el-icon-postcard" },
      },
      {
        path: "operationLog",
        id: "10-6",
        component: () => import("@/views/system/operationLog"),
        meta: { title: "操作日志", icon: "el-icon-postcard" },
      },
      {
        path: "taskManagement",
        id: "10-7",
        component: () => import("@/views/system/taskManagement"),
        meta: { title: "任务管理", icon: "el-icon-postcard" },
      },
      // ,{
      //   path: 'departmentScheduling',
      //   name: '科室排班',
      //   id: '10-8',
      //   component: () =>
      //     import('@/views/system/departmentScheduling'),
      //   meta: { title: '科室排班', icon: 'el-icon-postcard' }
      // },
    ],
  },
  {
    path: "/patientHome",
    redirect: "/patientHome/patientHome",
    component: Layout,
    type: "patientManagement",
    id: "22",
    meta: { title: "病人管理首页", icon: "el-icon-s-help" },
    children: [
      {
        path: "patientHome",
        id: "22-1",
        component: () => import("@/views/patientHome/patientHome"),
        meta: { title: "病人管理首页", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/NursingAssessment",
    redirect: "/NursingAssessment",
    name: "NursingAssessment",
    component: Layout,
    type: "patientManagement",
    id: "12",
    meta: { title: "护理评估", icon: "el-icon-document" },
    children: [
      {
        path: "AdmissionNursingSheet",
        name: "入院护理评估单",
        id: "12-1",
        component: () =>
          import("@/views/NursingAssessment/AdmissionNursingSheet"),
        meta: { title: "入院护理评估单", icon: "el-icon-postcard" },
      },
      {
        path: "Transfer",
        name: "转科交接",
        id: "12-3",
        component: () => import("@/views/NursingAssessment/Transfer"),
        meta: { title: "转科交接", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/Severe",
    redirect: "/Severe",
    name: "Severe",
    component: Layout,
    type: "patientManagement",
    id: "4",
    meta: { title: "重症评分", icon: "el-icon-s-help" },
    children: [
      {
        path: "apacheII",
        name: "APACHEⅡ评分",
        id: "4-17",
        component: () => import("@/views/Severe/apacheII"),
        meta: { title: "APACHEⅡ评分", icon: "el-icon-postcard" },
      },
      {
        path: "fall",
        name: "Morse跌倒评分",
        id: "4-3",
        component: () => import("@/views/Severe/fall"),
        meta: { title: "Morse跌倒评分", icon: "el-icon-postcard" },
      },
      {
        path: "pressureSore",
        name: "Braden压疮评分",
        id: "4-4",
        component: () => import("@/views/Severe/pressureSore"),
        meta: { title: "Braden压疮评分", icon: "el-icon-postcard" },
      },
      {
        path: "Glasgow",
        name: "Glasgow昏迷评分",
        id: "4-5",
        component: () => import("@/views/Severe/glasgow"),
        meta: { title: "Glasgow昏迷评分", icon: "el-icon-postcard" },
      },
      {
        path: "cpot",
        name: "CPOT疼痛评分",
        id: "4-6",
        component: () => import("@/views/Severe/cpot"),
        meta: { title: "CPOT疼痛评分", icon: "el-icon-postcard" },
      },
      {
        path: "padua",
        name: "VTE-Padua评分",
        id: "4-7",
        component: () => import("@/views/Severe/padua"),
        meta: { title: "VTE-Padua评分", icon: "el-icon-postcard" },
      },
      {
        path: "Caprini",
        name: "VTE-Caprini评分",
        id: "4-8",
        component: () => import("@/views/Severe/Caprini"),
        meta: { title: "VTE-Caprini评分", icon: "el-icon-postcard" },
      },
      {
        path: "autarDvt",
        name: "Autar-DVT风险评分",
        id: "4-9",
        component: () => import("@/views/Severe/autarDvt"),
        meta: { title: "Autar-DVT风险评分", icon: "el-icon-postcard" },
      },
      {
        path: "adl",
        name: "ADL自理能力评分",
        id: "4-10",
        component: () => import("@/views/Severe/adl"),
        meta: { title: "ADL自理能力评分", icon: "el-icon-postcard" },
      },
      {
        path: "rassSedation",
        name: "RASS镇静评分",
        id: "4-11",
        component: () => import("@/views/Severe/rassSedation"),
        meta: { title: "RASS镇静评分", icon: "el-icon-postcard" },
      },
      {
        path: "Nutritional-risk",
        name: "NRS2002营养风险评分",
        id: "4-12",
        component: () => import("@/views/Severe/Nutritional-risk"),
        meta: { title: "NRS2002营养风险评分", icon: "el-icon-postcard" },
      },
      {
        path: "cam",
        name: "Cam谵妄评分",
        id: "4-13",
        component: () => import("@/views/Severe/cam"),
        meta: { title: "Cam谵妄评分", icon: "el-icon-postcard" },
      },
      {
        path: "catheterRisk",
        name: "导管风险评分",
        id: "4-14",
        component: () => import("@/views/Severe/catheterRisk"),
        meta: { title: "导管风险评分", icon: "el-icon-postcard" },
      },
      {
        path: "catheterRiskFactors",
        name: "导管危险因素",
        id: "4-15",
        component: () => import("@/views/Severe/catheterRiskFactors"),
        meta: { title: "导管危险因素", icon: "el-icon-postcard" },
      },
      {
        path: "catheterFalling",
        name: "导管风险脱落评分",
        id: "4-16",
        component: () => import("@/views/Severe/catheterFalling"),
        meta: { title: "导管风险脱落评分", icon: "el-icon-postcard" },
      },
      {
        path: "SOFA",
        name: "SOFA评分",
        id: "4-18",
        component: () => import("@/views/Severe/SOFA"),
        meta: { title: "SOFA评分", icon: "el-icon-postcard" },
      },
      {
        path: "thrombus",
        name: "血栓风险评分",
        id: "12-2",
        component: () => import("@/views/Severe/thrombus"),
        meta: { title: "血栓风险评分", icon: "el-icon-postcard" },
      },
      {
        path: "pfit",
        name: "ICU体力功能测试（PFIT）",
        id: "5-18",
        component: () => import("@/views/Severe/pfit"),
        meta: { title: "ICU体力功能测试（PFIT）", icon: "el-icon-document" },
      },
    ],
  },
  {
    path: "/nursingDocument",
    redirect: "/nursingDocument",
    name: "nursingDocument",
    component: Layout,
    type: "patientManagement",
    id: "5",
    meta: { title: "护理管理", icon: "el-icon-document-copy" },
    children: [
      {
        path: "combinedSheet",
        name: "护理单文书",
        id: "5-1",
        component: () => import("@/views/nursingDocument/combinedSheet"),
        meta: { title: "护理单文书", icon: "el-icon-document" },
      },
      {
        path: "TemList",
        name: "体温单",
        id: "5-2",
        component: () => import("@/views/nursingDocument/TemList"),
        meta: { title: "体温单", icon: "el-icon-document" },
      },
      {
        path: "BloodGlucoseMon",
        name: "血糖监测",
        id: "5-6",
        component: () => import("@/views/nursingDocument/BloodGlucoseMon"),
        meta: { title: "血糖监测", icon: "el-icon-document" },
      },
      {
        path: "YouChuangGo",
        name: "有创动脉血压监测表",
        id: "5-12",
        component: () => import("@/views/nursingDocument/YouChuangGo"),
        meta: { title: "有创动脉血压监测表", icon: "el-icon-document" },
      },
      {
        path: "respiratoryTreatmentRecord",
        name: "呼吸治疗记录单",
        id: "5-17",
        component: () =>
          import("@/views/nursingDocument/respiratoryTreatmentRecord"),
        meta: { title: "呼吸治疗记录单", icon: "el-icon-document" },
      },
      {
        path: "crrtRecord",
        name: "CRRT护理记录",
        id: "5-15",
        component: () => import("@/views/nursingDocument/crrtRecord"),
        meta: { title: "CRRT护理记录", icon: "el-icon-document" },
      },
      {
        path: "pronePositionVentilation",
        name: "俯卧位通气治疗记录单",
        id: "5-14",
        component: () =>
          import("@/views/nursingDocument/pronePositionVentilation"),
        meta: { title: "俯卧位通气治疗记录单", icon: "el-icon-document" },
      },
      {
        path: "icuEcomRecord",
        name: "ICU-ECMO护理记录单",
        id: "5-16",
        component: () => import("@/views/nursingDocument/icuEcomRecord"),
        meta: { title: "ICU-ECMO护理记录", icon: "el-icon-document" },
      },
      {
        path: "spontaneousBreathing",
        name: "自主呼吸试验评估表",
        id: "5-13",
        component: () => import("@/views/nursingDocument/spontaneousBreathing"),
        meta: { title: "自主呼吸试验评估表", icon: "el-icon-document" },
      },
    ],
  },
  {
    path: "/medicaladvice",
    redirect: "/medicaladvice/medicaladvice",
    name: "medicaladvice",
    component: Layout,
    type: "patientManagement",
    id: "6",
    children: [
      {
        path: "medicaladvices",
        name: "医嘱列表",
        id: "6-1",
        component: () => import("@/views/medicaladvice/medicaladvices"),
        meta: { title: "医嘱列表", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/Zmedicaladvice",
    redirect: "/Zmedicaladvice/Zmedicaladvice",
    name: "Zmedicaladvice",
    component: Layout,
    type: "patientManagement",
    id: "18",
    children: [
      {
        path: "ZmedicaladviceTask",
        name: "医嘱自动执行计划",
        id: "18-1",
        component: () => import("@/views/Zmedicaladvice/ZmedicaladviceTask"),
        meta: { title: "医嘱自动执行计划", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/ZarrangeWork",
    redirect: "/ZarrangeWork/ZarrangeWork",
    component: Layout,
    type: "isWork",
    id: "19",
    meta: { title: "排班", icon: "el-icon-s-help" },
    children: [
      {
        path: "ZarrangeWork",
        id: "19-1",
        component: () => import("@/views/ZarrangeWork/ZarrangeWork"),
        meta: { title: "排班", icon: "el-icon-c-scale-to-original" },
      },
    ],
  },
  {
    path: "/ZsqlSettings",
    redirect: "/ZsqlSettings/ZsqlSettings",
    component: Layout,
    type: "isWork",
    id: "20",
    meta: { title: "sql设置", icon: "el-icon-s-help" },
    children: [
      {
        path: "ZsqlSettings",
        id: "20-1",
        component: () => import("@/views/ZsqlSettings/ZsqlSettings"),
        meta: { title: "sql设置", icon: "el-icon-c-scale-to-original" },
      },
    ],
  },
  {
    path: "/StatisticalAnalysis",
    redirect: "/StatisticalAnalysis",
    name: "StatisticalAnalysis",
    component: Layout,
    type: "patientManagement",
    id: "17",
    children: [
      {
        path: "Access",
        name: "出入量统计",
        id: "17-1",
        component: () => import("@/views/StatisticalAnalysis/Access"),
        meta: { title: "出入量统计", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/Handover",
    redirect: "/medicaladvice/Handover",
    name: "Handover",
    component: Layout,
    type: "patientManagement",
    id: "15",
    children: [
      {
        path: "handover",
        name: "交接班",
        id: "15-1",
        component: () => import("@/views/Handover/handover"),
        meta: { title: "交接班", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/operation",
    redirect: "/operation/operation",
    name: "operation",
    component: Layout,
    type: "patientManagement",
    id: "13",
    children: [
      {
        path: "operation",
        name: "手术查看",
        id: "13-1",
        component: () => import("@/views/operation/operation"),
        meta: { title: "手术查看", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/pipeline",
    redirect: "/pipeline/pipeline",
    name: "pipeline",
    component: Layout,
    type: "patientManagement",
    id: "14",
    children: [
      {
        path: "pipeline",
        name: "管路管理",
        id: "14-1",
        component: () => import("@/views/pipeline/pipeline"),
        meta: { title: "管路管理", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/shengmingtizheng",
    redirect: "/shengmingtizheng/shengmingtizheng",
    name: "shengmingtizheng",
    component: Layout,
    type: "patientManagement",
    id: "51",
    children: [
      {
        path: "shengmingtizheng",
        name: "生命体征",
        id: "51-1",
        component: () => import("@/views/shengmingtizheng/shengmingtizheng"),
        meta: { title: "生命体征", icon: "el-icon-postcard" },
      },
    ],
  },
  {
    path: "/self",
    redirect: "/self/self",
    name: "self",
    component: Layout,
    type: "patientManagement",
    id: "52",
    children: [
      {
        path: "self",
        name: "第三方",
        id: "52-1",
        component: () => import("@/views/self/self"),
        meta: { title: "第三方", icon: "el-icon-postcard" },
      },
    ],
  },
  // 404 page must be placed at the end !!!
  {
    path: "*",
    redirect: "/404",
    hidden: true,
  },
];

Router.selfaddRoutes = function (params) {
  Router.matcher = new Router().matcher;
  Router.addRoutes(params);
};
Router.$addRoutes = function (params) {
  Router.matcher = new Router({ mode: "history" }).matcher;
  Router.addRoutes(params);
};
const createRouter = () =>
  new Router({
    mode: "history", // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes,
  });

const router = createRouter();

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter();
  router.matcher = newRouter.matcher; // reset router

  return router;
}

export default router;
